<div class="layui-container">
    <div class="layui-row">
        <div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
			<div class="widget-head">
				<div class="widget-title">优惠券领取记录</div>
			</div>
			<div class="layui-col-sm12 layui-col-md12 widget-body">
				<div class="layui-col-sm12">
					<table width="100%" class="layui-table">
						<thead>
						<tr>
							<th class="layer-text-center">用户</th>
							<th>ID</th>
							<th>名称</th>
							<th>类型</th>
							<th>最低消费</th>
							<th>优惠方式</th>
							<th>有效期</th>
							<th>领取时间</th>
						</tr>
						</thead>
						<tbody>
						{if (!$list->isEmpty())}
							{volist name="list" id="item"}
								<tr>
									<td class="layer-text-center">
										<p class="">{$item['user']['nickName']}</p>
										<p class="layer-link-muted">(用户id：{$item['user_id']})</p>
									</td>
									<td class="layer-text-middle">{$item['coupon_id']}</td>
									<td class="layer-text-middle">{$item['name']}</td>
									<td class="layer-text-middle">{$item['coupon_type']['text']}</td>
									<td class="layer-text-middle">{$item['min_price']}</td>
									<td class="layer-text-middle">
										{if ($item['coupon_type']['value'] === 10) }
											<span>立减 <strong>{$item['reduce_price']}</strong> 元</span>
										{elseif ($item['coupon_type']['value'] === 20)/}
											<span>打 <strong>{$item['discount']}</strong> 折</span>
										{/if}
									</td>
									<td class="layer-text-middle">
										{if ($item['expire_type'] === 10)}
											<span>领取 <strong>{$item['expire_day']}</strong> 天内有效</span>
										{elseif ($item['expire_type'] === 20)}
											<span>{$item['start_time']['text']}
												~ {$item['end_time']['text']}</span>
										{/if}
									</td>
									<td class="layer-text-middle">{$item['create_time']}</td>
								</tr>
							{/volist}
						{else/}
							<tr>
								<td colspan="11" class="layer-text-center">暂无记录</td>
							</tr>
					   {/if}
						</tbody>
					</table>
				</div>
				<div class="layui-col-lg12 layer-cf">
					<div class="layer-fr">{$list|raw}</div>
					<div class="layer-fr pagination-total layer-margin-right">
						<div class="layer-vertical-align-middle">总记录：{$list->total()}</div>
					</div>
				</div>
			</div>
        </div>
    </div>
</div>
<script>
    $(function () {

        // 删除元素
        var url = "{:url('marketcoupon/delete')}";
        $('.item-delete').delete('coupon_id', url);

    });
</script>

